package com.bwie.system.mapper;

import com.bwie.common.domain.User;
import com.bwie.common.domain.request.UserReqList;
import com.bwie.common.domain.request.UserReqLogin;
import com.bwie.common.domain.request.UserReqSignUp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Author Junchen_N1
 * @Date 2025/6/17 9:31
 * @ClassName UserMapper
 * @Description TODO
 */
@Mapper
public interface UserMapper{
    User selectUserByUsernameAndPassword(UserReqLogin userReqLogin);

    List<User> selectUserFriendsListByUserId(@Param("userId") Integer userId, @Param("realName") String realName, @Param("sex") Integer sex);

    User selectUserByTel(@Param("tel") String tel);

    User selectUserByUsername(@Param("username") String username);

    void addUser(UserReqSignUp userReqSignUp);

    User findById(@Param("userId") Integer userId);

    void deleteFriend(@Param("userId") Integer userId, @Param("friendId") Integer friendId);

    List<User> selectNotMyFriendList(@Param("userReq") UserReqList userReqList, @Param("myFriendIdList") List<Integer> myFriendIdList);

    void addFriend(@Param("userId") Integer userId, @Param("friendId") Integer friendId);

    void updateUserBalance(@Param("userId") Integer userId, @Param("redPacketPrice") BigDecimal redPacketPrice,
                           @Param("status") Integer status);

    void addRedPacketReceived(@Param("redPacketId") Integer redPacketId, @Param("redPacketName") String redPacketName,
                              @Param("userId") Integer userId, @Param("username") String username, @Param("snatchPrice") BigDecimal snatchPrice);

    Integer selectCountsByUserIdOfFriendUser(@Param("userId") Integer userId);

    List<User> selectNotMyFriendListWithNoFriends(UserReqList userReqList);

    List<Integer> selectMyFriendIdList(@Param("userId") Integer userId);

    Integer findByIdOfUserRedPacketReceive(@Param("userId") Integer userId, @Param("redPacketId") Integer redPacketId);
}
